package cz.muni.fi.pa165.musiclibrary.impl.database.dao;

import java.util.List;

import cz.muni.fi.pa165.musiclibrary.impl.database.entity.IGenre;

/**
*
* @author Martin Majlath
* 2012-10-10T16:21:15+0200
*/
public interface IGenreDAO {

    /**
     * Add new entry of given genre to database.
     * Genre could not have assigned identifier.
     *  
     * @param genre Genre to be inserted
     * @throws TBD
     * <ul>
     *  <li>parameter is {@code null},</li>
     *  <li>genre identifier is <strong>not</strong> {@code null}.
     * </ul>
     */
    void create(final IGenre genre);
    
    /**
     * Edit existing entries selected by parameter which has to have assigned
     * identifier.
     * 
     * @param genre Genre to be updated
     * @throws IllegalArgumentException If:
     * <ul>
     *  <li>parameter is {@code null},</li>
     *  <li>genre identifier is {@code null}.
     * </ul>
     */
    void update(final IGenre genre);
    
    /**
     * Remove entry by given parameter which has to have assigned identifier.
     * 
     * @param genre to be removed
     * @throws IllegalArgumentException If:
     * <ul>
     *  <li>parameter is {@code null},</li>
     *  <li>genre identifier is {@code null}.
     * </ul>
     */
    void delete(final IGenre genre);
    
    /**
     * Find and return entity by ({@link #getIdGenre()})
     * 
     * @param idGenre defines which entry should be found
     * @return adequate entity or {@code null} if there is none for given identifier.
     */   
    IGenre getById(final Long idGenre);
    
    /**
     * Return collection of all genres stored in database.
     * Never returns {@code null}, if there are no 
     *  genres, returns empty list.
     * 
     * @return collection of all genres
     */
    List<IGenre> getAll();
}
